package com.sky.mapper;

import com.sky.entity.DishFlavor;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface DishFlavorMapper {
    /**
     * 根据菜品id查询口味信息
     * @param id
     * @return
     */
    @Select("select id, dish_id, name, value from dish_flavor where dish_id=#{id}")
    List<DishFlavor> findByDishId(Long id);

    /**
     * 新增菜品的口味
     * @param dishFlavor
     */
    void add(DishFlavor dishFlavor);

    /**
     * 删除菜品的口味
     * @param dishId
     */
    @Delete("delete from dish_flavor where dish_id=#{dishId}")
    void delete(Long dishId);
}
